package com.meilingcloud.biobank.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 家系样本源 对象 bank_family_source
 *
 * @author chenl
 * @date 2021-06-22
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("bank_family_source")
public class FamilySource implements Serializable {

    private static final long serialVersionUID = 1L;


    /**
     * 家系样本源ID
     */
    @TableId(value = "family_source_id", type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long familySourceId;

    /**
     * 家系ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @NotNull(message = "家系不能为空")
    private Long familyId;

    /**
     * 样本源ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long sourceId;

    /**
     * 家系样本源父ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long familySourcePid;

    /**
     * 家系样本源配偶ID
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long familySourceMid;

    /**
     * 样本源编号
     */
    private String sourceCode;

    /**
     * 样本源名称
     */
    private String sourceName;

    /**
     * 样本源性别 0-男 1-女
     */
    private String sourceSex;

    /**
     * 是否死亡 0-否 1-是
     */
    private String sourceDead;

    /**
     * 是否患者 0-否 1-是
     */
    private String sourcePatient;

    /**
     * 是否携带 0-否 1-是
     */
    private String sourceCarry;

    /**
     * 删除标志
     */
    @TableLogic(value = "0", delval = "1")
    private String delFlag;

    /**
     * 创建者
     */
    private String createBy;

    /**
     * 创建时间
     */
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 更新者
     */
    private String updateBy;

    /**
     * 更新时间
     */
    @TableField(value = "update_time", fill = FieldFill.UPDATE)
    private Date updateTime;

    /**
     * 父样本
     */
    @TableField(exist = false)
    private FamilySource parentSource;

    /**
     * 子样本
     */
    @TableField(exist = false)
    private List<FamilySource> children;

    /**
     * 配偶样本
     */
    @TableField(exist = false)
    private List<FamilySource> mate;

    /**
     * 家系样本源子ID - 新增时使用
     */
    @TableField(exist = false)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long familySourceCid;

    /**
     * 类型
     */
    @TableField(exist = false)
    private int type;

    @TableField(exist = false)
    private Map<String, Object> params = new HashMap<>();
}
